package com.myres.model;

import java.sql.Timestamp;
import java.util.Set;

public class Bulk {

	private int id;
	private int createrId;
	private User creater;
	private Timestamp sendTime;
	private String description;
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	private int maxMember;
	private int memberCount;
	private int state;
	/**
	 * state==0 normal; state==1 disabled;
	 */
	public static int NORMAL = 0;
	public static int DISABLED = 1;

	private Set<Order> orders;

	public User getCreater() {
		return creater;
	}

	public void setCreater(User creater) {
		this.creater = creater;
		this.createrId=creater.getId();
	}


	public Set<Order> getOrders() {
		return orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}

	public void setState(int state) {
		this.state = state;
	}

	public int getState() {
		return state;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	public int getCreaterId() {
		return createrId;
	}
	public void setCreaterId(int createrId) {
		this.createrId = createrId;
	}
	public Timestamp getSendTime() {
		return sendTime;
	}

	public void setSendTime(Timestamp sendTime) {
		this.sendTime = sendTime;
		if (sendTime.getTime() < System.currentTimeMillis() + 5 * 60 * 1000)
			state = 1;
	}

	public int getMaxMember() {
		return maxMember;
	}

	public void setMaxMember(int maxMember) {
		this.maxMember = maxMember;

	}

	public int getMemberCount() {
		return memberCount;
	}

	public void setMemberCount(int memberCount) {
		this.memberCount = memberCount;
		if (memberCount == maxMember)
			state = 1;
	}
}
